package com.distribute.framework.model;

import com.distribute.framework.core.web.helper.Utils;
import java.lang.reflect.Field;
import java.util.Date; 
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;

import javax.annotation.Resource;

import com.distribute.framework.core.web.util.Page;
import com.distribute.framework.core.lang.*; 
import com.distribute.framework.core.web.helper.WebHelper.LzMap;
import com.distribute.framework.core.util.Function;
import com.distribute.framework.core.util.IbatisMap;
import com.distribute.framework.config.*;
import com.distribute.framework.plugin.*;

@namespace("permissions/login")
public @caption("登录帐号") @database(DatabaseNames.distribute_sys) @source("distribute_sys") @table("srv_login") class SrvLogin implements java.io.Serializable
{
	private static final long serialVersionUID = 1l;
	private @caption("编号") @column("sl_id")    @primary  @notnull  @note("  ") Long slId;// 主键 非空     
	private @caption("用户名") @column("sl_username")     @notnull  @note("  ") String slUsername;// 非空     
	private @caption("密码") @column("sl_password")   @hidden   @notnull  @note("  ") String slPassword;// 非空     
	private @caption("真实姓名") @column("sl_real_name")     @notnull  @note("  ") String slRealName;// 非空     
	private @caption("昵称") @column("sl_nick_name")      @note(" 0:女 1:男  ") String slNickName;// 0:女 1:男     
	private @caption("头像") @column("sl_portrait")      @note("  ") String slPortrait;//     
	private @caption("个性签名") @column("sl_signature") @like     @note("  ") String slSignature;//     
	private @caption("微信ID") @column("sl_wx_openid")      @note("  ") String slWxOpenid;//     
	private @caption("当前用户") @column("sl_curr_user")      @relate("$slCurrUser") @RelateClass(SrvUser.class)  @note("  ") Long slCurrUser;//     
 	private transient SrvUser $slCurrUser;//关联对象[人员信息]
	private @caption("添加时间") @column("sl_add_time")      @note("  ") Date slAddTime;//     
	private @caption("最后登录时间") @column("sl_last_time")      @note("  ") Date slLastTime;//     
	private @caption("最后登录IP") @column("sl_last_ip")      @note("  ") String slLastIp;//     
	private @caption("状态") @column("sl_status")     @notnull  @note(" 1:有效 0:无效  ") Short slStatus;// 非空 1:有效 0:无效     
	 
	//默认构造函数
	public SrvLogin(){ 
	
	}
	
	//主键构造函数
	public SrvLogin(Long id){
		this.slId = id;
	}
	
	/**所有字段构造函数 
	 SrvLogin(
	 	Utils.getString("slUsername")//用户名 [非空]
	 	,Utils.getString("slPassword")//密码 [非空]
	 	,Utils.getString("slRealName")//真实姓名 [非空]
	 	,Utils.getString("slNickName")//昵称
	 	,Utils.getString("slPortrait")//头像
	 	,Utils.getString("slSignature")//个性签名
	 	,Utils.getString("slWxOpenid")//微信ID
	 	,Utils.getLong("slCurrUser")//当前用户
	 	,Utils.getDate("slAddTime")//添加时间
	 	,Utils.getDate("slLastTime")//最后登录时间
	 	,Utils.getString("slLastIp")//最后登录IP
	 	,Utils.getShort("slStatus")//状态 [非空]
	 )
	**/
	public SrvLogin(String slUsername,String slPassword,String slRealName,String slNickName,String slPortrait,String slSignature,String slWxOpenid,Long slCurrUser,Date slAddTime,Date slLastTime,String slLastIp,Short slStatus){
		this.slUsername=slUsername;
		this.slPassword=slPassword;
		this.slRealName=slRealName;
		this.slNickName=slNickName;
		this.slPortrait=slPortrait;
		this.slSignature=slSignature;
		this.slWxOpenid=slWxOpenid;
		this.slCurrUser=slCurrUser;
		this.slAddTime=slAddTime;
		this.slLastTime=slLastTime;
		this.slLastIp=slLastIp;
		this.slStatus=slStatus;
	}
	
	//设置非空字段
	public SrvLogin setNotNull(String slUsername,String slPassword,String slRealName,Short slStatus){
		this.slUsername=slUsername;
		this.slPassword=slPassword;
		this.slRealName=slRealName;
		this.slStatus=slStatus;
		return this;
	}
	/** 编号 [非空]       **/
	public SrvLogin slId(Long slId){
		this.slId = slId;
		this.setSeted(F.slId);
		return this;
	}
	/** 用户名 [非空]       **/
	public SrvLogin slUsername(String slUsername){
		this.slUsername = slUsername;
		this.setSeted(F.slUsername);
		return this;
	}
	/** 密码 [非空]       **/
	public SrvLogin slPassword(String slPassword){
		this.slPassword = slPassword;
		this.setSeted(F.slPassword);
		return this;
	}
	/** 真实姓名 [非空]       **/
	public SrvLogin slRealName(String slRealName){
		this.slRealName = slRealName;
		this.setSeted(F.slRealName);
		return this;
	}
	/** 昵称    0:女 1:男     **/
	public SrvLogin slNickName(String slNickName){
		this.slNickName = slNickName;
		this.setSeted(F.slNickName);
		return this;
	}
	/** 头像        **/
	public SrvLogin slPortrait(String slPortrait){
		this.slPortrait = slPortrait;
		this.setSeted(F.slPortrait);
		return this;
	}
	/** 个性签名        **/
	public SrvLogin slSignature(String slSignature){
		this.slSignature = slSignature;
		this.setSeted(F.slSignature);
		return this;
	}
	/** 微信ID        **/
	public SrvLogin slWxOpenid(String slWxOpenid){
		this.slWxOpenid = slWxOpenid;
		this.setSeted(F.slWxOpenid);
		return this;
	}
	/** 当前用户  [SrvUser]      **/
	public SrvLogin slCurrUser(Long slCurrUser){
		this.slCurrUser = slCurrUser;
		this.setSeted(F.slCurrUser);
		return this;
	}
	/** 添加时间        **/
	public SrvLogin slAddTime(Date slAddTime){
		this.slAddTime = slAddTime;
		this.setSeted(F.slAddTime);
		return this;
	}
	/** 最后登录时间        **/
	public SrvLogin slLastTime(Date slLastTime){
		this.slLastTime = slLastTime;
		this.setSeted(F.slLastTime);
		return this;
	}
	/** 最后登录IP        **/
	public SrvLogin slLastIp(String slLastIp){
		this.slLastIp = slLastIp;
		this.setSeted(F.slLastIp);
		return this;
	}
	/** 状态 [非空]   1:有效 0:无效     **/
	public SrvLogin slStatus(Short slStatus){
		this.slStatus = slStatus;
		this.setSeted(F.slStatus);
		return this;
	}
	
	
	/**
	* 克隆对象
	**/
	public SrvLogin clone(){
		SrvLogin clone = new SrvLogin();
		clone.slUsername=this.slUsername;
		clone.slPassword=this.slPassword;
		clone.slRealName=this.slRealName;
		clone.slNickName=this.slNickName;
		clone.slPortrait=this.slPortrait;
		clone.slSignature=this.slSignature;
		clone.slWxOpenid=this.slWxOpenid;
		clone.slCurrUser=this.slCurrUser;
		clone.slAddTime=this.slAddTime;
		clone.slLastTime=this.slLastTime;
		clone.slLastIp=this.slLastIp;
		clone.slStatus=this.slStatus;
		return clone;
	}
	/**
	* 清除缓存
	**/
	public void clear(){
		Cache.clearObject(SrvLogin.M.class);
		Cache.clearValue(SrvLogin.M.class);
		Cache.deleteObject(SrvLogin.class, this.getId());
	}
	
	/**
	* 清除缓存
	**/
	public static void clear(Long id){
		Cache.clearObject(SrvLogin.M.class);
		Cache.clearValue(SrvLogin.M.class);
		Cache.deleteObject(SrvLogin.class, id);
	}
	
	
	/**
	 * 根据ID取登录帐号
	 * @param id
	 * @return
	 */
	public static @api SrvLogin get(Long id){		
		return getSrvLoginById(id);
	}
	/**
	 * 设置ID
	 * @param id
	 * @return
	 */
	public void setId(Long id){		
		this.slId = id;
	}
	
	/**
	 * 获取所有登录帐号
	 * @return
	 */
	public static @api List<SrvLogin> list(Map params,Integer size){
		return getSrvLoginList(params,size);
	}
	/**
	 * 获取登录帐号分页
	 * @return
	 */
	public static @api Page<SrvLogin> page(Integer page,Integer size,Map params){
		return getSrvLoginPage(page, size , params);
	}
	
	
	/**
	 * 根据查询条件取登录帐号
	 * @param params
	 * @return
	 */
	public static @api SrvLogin Get(Map params){
		return getSrvLogin(params);
	}
	/**
	 * 获取登录帐号数
	 * @return
	 */
	public static @api Long count(Map params){
		return getSrvLoginCount(params);
	}
	/**
	 * 获取登录帐号数
	 * @return
	 */
	public static @api <T> T eval(String eval,Map params){
		return getSrvLoginEval(eval,params);
	}
	/**
	 * 获取登录帐号图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> stats(Map params,C sumKey,C groupKey){
		return getSrvLoginStats(params,sumKey,groupKey,-1);
	}
	/**
	 * 获取登录帐号图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 分组的字段
	 * @param dateType 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> stats(Map params,C sumKey,C groupKey,int dateType){
		return getSrvLoginStats(params,sumKey,groupKey,dateType);
	}
	
	/**
	 * 根据ID取登录帐号
	 * @param id
	 * @return
	 */
	public static @api SrvLogin getSrvLoginById(Long id){		
		return getSrvLoginDao().getSrvLoginById(id);
	}
	/**
	 * 获取id
	 * @return
	 */
	public Long getId(){
		return this.slId;
	}
	
	
	/**
	 * 根据ID取登录帐号的标识键值
	 * @param id
	 * @return
	 */
	public static @api String getKeyValue(Object key){
		Long id = Utils.parseLong(key);	
		if(id==null || id.longValue()==0 ){
			return null;
		}
		String value = null;
		value = Cache.getValue(SrvLogin.class, id);
		if(value==null){
			SrvLogin srvLogin = get(id);
			if(srvLogin!=null){
				String strValue = srvLogin.getSlUsername$();
				if(!"SlUsername".equals("SlUsername"))
					strValue+="("+srvLogin.getSlUsername$()+")";
				if(!"SlUsername".equals("SlRealName"))
					strValue+="("+srvLogin.getSlRealName$()+")";
				Cache.setValue(SrvLogin.class, id ,strValue);
				value = strValue;
			}else{
				Cache.setValue(SrvLogin.class, id ,"{"+id+"}",30);
				value = "{"+id+"}";
			}
		}
		/************LAZY3Q_ID_KEYVALUE************/
		/************LAZY3Q_ID_KEYVALUE************/
		return value;
	}	
	
	
	/**
	 * 获取当前对象的键值
	 * @return
	 */
	public String getKeyValue(){
		/************LAZY3Q_CODE_KEYVALUE************/
		/************LAZY3Q_CODE_KEYVALUE************/
		String keyValue = this.getSlUsername$();
		if(!"SlUsername".equals("SlUsername"))
			keyValue+="("+this.getSlUsername$()+")";
		if(!"SlUsername".equals("SlRealName"))
			keyValue+="("+this.getSlRealName$()+")";
		return keyValue;
	}
	
	
	/**
	 * 根据关键字精确查询登录帐号对象
	 * @return
	 */
	public static @api SrvLogin find(String key){
		if(Utils.empty(key))return null;
		Map params = new HashMap();
		if(key.toLowerCase().startsWith("id:"))//如果查询条件以id:开头，则按ID查询
			params.put("slId", key.toLowerCase().replaceFirst("id:", ""));					
		else{//按标识查询，精确查询
			String strDefinex = "";
			strDefinex+=" or sl_username = '"+key.replaceAll("'", "''")+"'";
			strDefinex+=" or sl_real_name = '"+key.replaceAll("'", "''")+"'";
			strDefinex="(2=1 "+strDefinex+")";
			params.put("definex",strDefinex);
		}
		/************LAZY3Q_CODE_FIND************/
		/************LAZY3Q_CODE_FIND************/
		return SrvLogin.getSrvLogin(params);
	}
	
	
	/**
	 * 根据关键字查询登录帐号
	 * @return
	 */
	public static @api List<Map> query(String key,int size,Map params,Boolean bObject){
		if(Utils.empty((String)params.get("asc")) && Utils.empty((String)params.get("desc")))//如果未传入排序字段
			params.put("desc","sl_id");//那么，默认以主键降序，传给Dao层
		String strTerm=key;		
		if(!Utils.empty(strTerm)){
			if(strTerm.toLowerCase().startsWith("id:"))//如果查询条件以id:开头，则按ID查询
				params.put("slId", strTerm.toLowerCase().replaceFirst("id:", ""));					
			else//按标识查询，模糊查询请带%
			{
				String strDefinex = "";
				strDefinex+=" or sl_username like '%"+strTerm.replaceAll("'", "''")+"%'";
				strDefinex+=" or sl_real_name like '%"+strTerm.replaceAll("'", "''")+"%'";
				strDefinex="(2=1 "+strDefinex+")";
				params.put("definex",strDefinex);
			}
		}
		/************LAZY3Q_CODE_QUERY************/
		/************LAZY3Q_CODE_QUERY************/
			
		List<SrvLogin> list = page(0,size,params).getResult();
		
		/**
		* OK!取到数据拼成放入Map中，[{value,text,object:{...}},...]
		* value:数据ID，text:数据标识,object,整个对象
		**/
		List<Map> result = new java.util.ArrayList();
		for(SrvLogin srvLogin:list){
			Map map = new HashMap();
			map.put("key",srvLogin.getSlId().toString());
			map.put("value", Utils.js(srvLogin.getKeyValue()));
			if(bObject==true)
				map.put("object",srvLogin);
			result.add(map);
		}
		/************LAZY3Q_AFTER_QUERY************/
		/************LAZY3Q_AFTER_QUERY************/
		
		return result;
	}
	
	
	
	/**
	 * 获取所有登录帐号
	 * @return
	 */
	public static @api List<SrvLogin> getSrvLoginList(Map params,Integer size){
		return getSrvLoginDao().getSrvLoginList(params,0,size);
	}
	
	/**
	 * 获取登录帐号分页
	 * @return
	 */
	public static @api Page<SrvLogin> getSrvLoginPage(Integer page,Integer size,Map params){
		if(page==null)page=0;
		if(size==null)size=20;
		return getSrvLoginDao().getSrvLoginPage(page, size , params);
	}
	
	/**
	 * 根据查询条件取登录帐号
	 * @param params
	 * @return
	 */
	public static @api SrvLogin getSrvLogin(Map params){
		return getSrvLoginDao().getSrvLogin(params);
	}
	
	/**
	 * 保存一个登录帐号
	 * @param srvLogin
	 * @return
	 */
	public static @api SrvLogin saveSrvLogin(SrvLogin srvLogin){
		return getSrvLoginDao().saveSrvLogin(srvLogin);
	}
	
	/**
	 * 根据条件更新登录帐号
	 * @param values
	 * @param params
	 */
	public static @api int updateSrvLoginByConfirm(Map values, Map params){
		return getSrvLoginDao().updateSrvLoginByConfirm(values,params);
	}
	
	/**
	 * 修改一个登录帐号
	 * @param srvLogin
	 * @return
	 */
	public static @api int updateSrvLogin(SrvLogin srvLogin){
		return getSrvLoginDao().updateSrvLogin(srvLogin);
	}
	
	/**
	 * 更新登录帐号非空字段
	 * @param srvLogin
	 */
	public static @api int updateSrvLogin$NotNull(SrvLogin srvLogin){
		return getSrvLoginDao().updateSrvLogin$NotNull(srvLogin);
	}
	
	/**
	 * 获取登录帐号数
	 * @return
	 */
	public static @api Long getSrvLoginCount(Map params){
		return getSrvLoginDao().getSrvLoginCount(params);
	}
		
		
	/**
	 * 获取登录帐号自定义求和表达式,比如求和:eval="sum(id)"
	 * @return
	 */	
	public static @api <T> T getSrvLoginEval(String eval,Map params){
		return getSrvLoginDao().getSrvLoginEval(eval,params);
	}
	/**
	 * 获取登录帐号图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 分组的字段
	 * @param dateType 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> getSrvLoginStats(Map params,C sumKey,C groupKey,int dateType){
		//TODO:图表统计功能未实现
		
		Map<String,Object> groups=new HashMap();//要分组的字段
		Map<String,Object> sums=new HashMap();//要统计的字段
		
		String[][] dateFormats=new String[][]{
				null,
				new String[]{"%Y","yyyy年","Y"},
				new String[]{"%Y-%m","yyyy年MM月","M"},
				new String[]{"%Y%U","yyyy年第ww周","W"},
				new String[]{"%Y-%m-%d","yyyy年MM月dd日","D"},
				new String[]{"%Y-%m-%d %H","yyyy年MM月dd日 HH点","H"},
				new String[]{"%m","MM月"},
				new String[]{"%d","dd号"},
				new String[]{"%H","HH点"} 
		};
		
		//获取要分组的字段，放入Map中
		if(dateType>0){
			groups.put(groupKey.toString(),"DATE_FORMAT({key},'"+dateFormats[dateType][0]+"')");
		}else{
			groups.put(groupKey.toString(),"{key}");
		}
		if(dateType<6 && dateType>0){ 
			params.put("asc", groupKey.toString()); 
			if(params.get(groupKey.name()+"Start")==null){
				params.put(groupKey.name()+"Start", Utils.date(new Date(), -24, dateFormats[dateType][2]));
			}
		}
		
		
		//获取要统计的字段，放入Map中
		if(sumKey.toString().equals("count")){
			sums.put(sumKey.toString(),"count(*)");
		}else{
			sums.put(sumKey.toString(),"sum({key})");
		}
		
		List<Map> list = getSrvLoginDao().getSrvLoginStats(params,groups,sums);
		
		List<Map> result = new ArrayList();
		for(Map m:list){
			Map map = new HashMap();
			Object value = m.get(sumKey.toString());
			Object name = null;
			Object groupValue = m.get(groupKey.toString());
			if(dateType>0){
				name = Utils.date(Utils.parseDate(groupValue), dateFormats[dateType][1]);
			}else{
				try{
					java.lang.reflect.Method method = SrvLogin.class.getMethod("get"+Utils.ForMat(groupKey.toString())+"$");
					method.setAccessible(true);
					name = method.invoke(SrvLogin.fromMap(m));
				}catch(Exception ex){
					ex.printStackTrace();
				}
			}
			map.put("name", name);
			map.put("value", value);
			result.add(map);
		}
		return result;
	}
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static int updateSrvLogin(Map set,Map where){
		if(set.isEmpty())throw new RuntimeException("set为空");
		if(where.isEmpty())throw new RuntimeException("where为空");
		where.put("confirm", "1");
		return getSrvLoginDao().updateSrvLoginByConfirm(set, where);
	}
	
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static void deleteSrvLogin(Map where){
		if(where.isEmpty())throw new RuntimeException("where为空");
		where.put("confirm", "1");
		getSrvLoginDao().deleteSrvLoginByConfirm(where);
	}
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static void delete(Long id){
		if(id==null)throw new RuntimeException("id为空");
		getSrvLoginDao().removeSrvLoginById(id);
	}
	
	
	/**
	 * 保存登录帐号对象
	 * @param params
	 * @return
	 */
	public SrvLogin save(){
		if(this.getSlId()!=null)
			getSrvLoginDao().updateSrvLogin(this);
		else
			return getSrvLoginDao().saveSrvLogin(this);
		return this;
	}
	
	
	/**
	 * 更新登录帐号对象的非空字段,注意跟Service里面的update不一样哦
	 * @param params
	 * @return
	 */
	public int update(){
		return getSrvLoginDao().updateSrvLogin$NotNull(this);
	}
	
	
	/**
	 * 删除
	 * @param params
	 * @return
	 */
	public void delete(){
		if(Utils.equals(Utils.config("logic_delete"),"true"))
			getSrvLoginDao().removeSrvLoginById(this.getSlId());
		else
			getSrvLoginDao().deleteSrvLoginById(this.getSlId());
	}
	
	/**
	 * 执行事务
	 * @param function
	 */
	public static <T> T execute(Function function){
		return getSrvLoginDao().executeTransaction(function);
	}
	/*******************************编号**********************************/	
	/**
	* 编号 [非空]      
	**/
	public Long getSlId(){
		if(this.slId!=null){
			return this.slId;
		}
		return this.slId;
	}
	/**
	* 获取编号格式化(toString)
	**/
	public String getSlId$(){
		String strValue="";
		 strValue=Utils.string(this.getSlId());
	 	 return strValue;
	}
	/**
	* 根据编号反格式化
	**/
	public void setSlId$(String strValue){
		if(Utils.empty(strValue)){
			this.slId=null;
			return;
		}
	 	this.slId=Utils.parseLong(strValue);
	}
	
	/**
	* 编号 [非空]      
	**/
	public void setSlId(Long slId){
		this.slId = slId;
		this.setSeted(F.slId);
	}
	
	
	
	
	/*******************************用户名**********************************/	
	/**
	* 用户名 [非空]      
	**/
	public String getSlUsername(){
		if(this.slUsername!=null){
			return this.slUsername;
		}
		return this.slUsername;
	}
	/**
	* 获取用户名格式化(toString)
	**/
	public String getSlUsername$(){
		String strValue="";
		 strValue=Utils.string(this.getSlUsername());
	 	 return strValue;
	}
	/**
	* 根据用户名反格式化
	**/
	public void setSlUsername$(String strValue){
		if(Utils.empty(strValue)){
			this.slUsername=null;
			return;
		}
	 	this.slUsername=strValue;
	}
	
	/**
	* 用户名 [非空]      
	**/
	public void setSlUsername(String slUsername){
		this.slUsername = slUsername;
		this.setSeted(F.slUsername);
	}
	
	
	
	
	/*******************************密码**********************************/	
	/**
	* 密码 [非空]      
	**/
	public String getSlPassword(){
		if(this.slPassword!=null){
			return this.slPassword;
		}
		return this.slPassword;
	}
	/**
	* 获取密码格式化(toString)
	**/
	public String getSlPassword$(){
		String strValue="";
		 strValue=Utils.string(this.getSlPassword());
	 	 return strValue;
	}
	/**
	* 根据密码反格式化
	**/
	public void setSlPassword$(String strValue){
		if(Utils.empty(strValue)){
			this.slPassword=null;
			return;
		}
	 	this.slPassword=strValue;
	}
	
	/**
	* 密码 [非空]      
	**/
	public void setSlPassword(String slPassword){
		this.slPassword = slPassword;
		this.setSeted(F.slPassword);
	}
	
	
	
	
	/*******************************真实姓名**********************************/	
	/**
	* 真实姓名 [非空]      
	**/
	public String getSlRealName(){
		if(this.slRealName!=null){
			return this.slRealName;
		}
		return this.slRealName;
	}
	/**
	* 获取真实姓名格式化(toString)
	**/
	public String getSlRealName$(){
		String strValue="";
		 strValue=Utils.string(this.getSlRealName());
	 	 return strValue;
	}
	/**
	* 根据真实姓名反格式化
	**/
	public void setSlRealName$(String strValue){
		if(Utils.empty(strValue)){
			this.slRealName=null;
			return;
		}
	 	this.slRealName=strValue;
	}
	
	/**
	* 真实姓名 [非空]      
	**/
	public void setSlRealName(String slRealName){
		this.slRealName = slRealName;
		this.setSeted(F.slRealName);
	}
	
	
	
	
	/*******************************昵称**********************************/	
	/**
	* 昵称    0:女 1:男    
	**/
	public String getSlNickName(){
		if(this.slNickName!=null){
			return this.slNickName;
		}
		return this.slNickName;
	}
	/**
	* 获取昵称格式化(toString)
	**/
	public String getSlNickName$(){
		String strValue="";
		 strValue=Utils.string(this.getSlNickName());
	 	 return strValue;
	}
	/**
	* 根据昵称反格式化
	**/
	public void setSlNickName$(String strValue){
		if(Utils.empty(strValue)){
			this.slNickName=null;
			return;
		}
	 	this.slNickName=strValue;
	}
	
	/**
	* 昵称    0:女 1:男    
	**/
	public void setSlNickName(String slNickName){
		this.slNickName = slNickName;
		this.setSeted(F.slNickName);
	}
	
	
	
	
	/*******************************头像**********************************/	
	/**
	* 头像       
	**/
	public String getSlPortrait(){
		if(this.slPortrait!=null){
			return this.slPortrait;
		}
		return this.slPortrait;
	}
	/**
	* 获取头像格式化(toString)
	**/
	public String getSlPortrait$(){
		String strValue="";
		 strValue=Utils.string(this.getSlPortrait());
	 	 return strValue;
	}
	/**
	* 根据头像反格式化
	**/
	public void setSlPortrait$(String strValue){
		if(Utils.empty(strValue)){
			this.slPortrait=null;
			return;
		}
		this.slPortrait=Utils.parseString(strValue);
	}
	
	/**
	* 头像       
	**/
	public void setSlPortrait(String slPortrait){
		this.slPortrait = slPortrait;
		this.setSeted(F.slPortrait);
	}
	
	
	
	
	/*******************************个性签名**********************************/	
	/**
	* 个性签名       
	**/
	public String getSlSignature(){
		if(this.slSignature!=null){
			return this.slSignature;
		}
		return this.slSignature;
	}
	/**
	* 获取个性签名格式化(toString)
	**/
	public String getSlSignature$(){
		String strValue="";
		 strValue=Utils.string(this.getSlSignature());
	 	 return strValue;
	}
	/**
	* 根据个性签名反格式化
	**/
	public void setSlSignature$(String strValue){
		if(Utils.empty(strValue)){
			this.slSignature=null;
			return;
		}
		this.slSignature=strValue;
	}
	
	/**
	* 个性签名       
	**/
	public void setSlSignature(String slSignature){
		this.slSignature = slSignature;
		this.setSeted(F.slSignature);
	}
	
	
	
	
	/*******************************微信ID**********************************/	
	/**
	* 微信ID       
	**/
	public String getSlWxOpenid(){
		if(this.slWxOpenid!=null){
			return this.slWxOpenid;
		}
		return this.slWxOpenid;
	}
	/**
	* 获取微信ID格式化(toString)
	**/
	public String getSlWxOpenid$(){
		String strValue="";
		 strValue=Utils.string(this.getSlWxOpenid());
	 	 return strValue;
	}
	/**
	* 根据微信ID反格式化
	**/
	public void setSlWxOpenid$(String strValue){
		if(Utils.empty(strValue)){
			this.slWxOpenid=null;
			return;
		}
	 	this.slWxOpenid=strValue;
	}
	
	/**
	* 微信ID       
	**/
	public void setSlWxOpenid(String slWxOpenid){
		this.slWxOpenid = slWxOpenid;
		this.setSeted(F.slWxOpenid);
	}
	
	
	
	
	/*******************************当前用户**********************************/	
	/**
	* 当前用户  [SrvUser]     
	**/
	public Long getSlCurrUser(){
		if(this.slCurrUser!=null){
			return this.slCurrUser;
		}
		return this.slCurrUser;
	}
	/**
	* 获取当前用户格式化(toString)
	**/
	public String getSlCurrUser$(){
		String strValue="";
		if(this.getSlCurrUser()!=null){
				strValue+=Utils.string(SrvUser.getKeyValue(this.getSlCurrUser()));
		}			
	 	 return strValue;
	}
	/**
	* 根据当前用户反格式化
	**/
	public void setSlCurrUser$(String strValue){
		if(Utils.empty(strValue)){
			this.slCurrUser=null;
			return;
		}
		SrvUser item = SrvUser.find(strValue);
		if(item!=null){
			this.slCurrUser = Utils.parseLong(item.getSuId());
		}
	}
	
	/**
	* 当前用户  [SrvUser]     
	**/
	public void setSlCurrUser(Long slCurrUser){
		this.slCurrUser = slCurrUser;
		this.setSeted(F.slCurrUser);
	}
	
	
	
	
	/**
	* 获取关联对象[人员信息]
	**/	 			
 	public SrvUser get$slCurrUser(){
 		if(this.$slCurrUser!=null)
 			return this.$slCurrUser;
 		com.distribute.framework.model.SrvUser srvUser = null;
		if(this.getSlCurrUser()!=null){
 			srvUser = SrvUser.get(this.getSlCurrUser());
 		}
 		return srvUser;
	}
	/*******************************添加时间**********************************/	
	/**
	* 添加时间       
	**/
	public Date getSlAddTime(){
		if(this.slAddTime!=null){
			return this.slAddTime;
		}
		return this.slAddTime;
	}
	/**
	* 获取添加时间格式化(toString)
	**/
	public String getSlAddTime$(){
		String strValue="";
		 strValue=Utils.string(Utils.date(this.getSlAddTime(),"yyyy-MM-dd"));
	 	 return strValue;
	}
	/**
	* 根据添加时间反格式化
	**/
	public void setSlAddTime$(String strValue){
		if(Utils.empty(strValue)){
			this.slAddTime=null;
			return;
		}
	 	this.slAddTime=Utils.date(strValue,"yyyy-MM-dd");
	}
	
	/**
	* 添加时间       
	**/
	public void setSlAddTime(Date slAddTime){
		this.slAddTime = slAddTime;
		this.setSeted(F.slAddTime);
	}
	
	
	
	
	/*******************************最后登录时间**********************************/	
	/**
	* 最后登录时间       
	**/
	public Date getSlLastTime(){
		if(this.slLastTime!=null){
			return this.slLastTime;
		}
		return this.slLastTime;
	}
	/**
	* 获取最后登录时间格式化(toString)
	**/
	public String getSlLastTime$(){
		String strValue="";
		 strValue=Utils.string(Utils.date(this.getSlLastTime(),"yyyy-MM-dd"));
	 	 return strValue;
	}
	/**
	* 根据最后登录时间反格式化
	**/
	public void setSlLastTime$(String strValue){
		if(Utils.empty(strValue)){
			this.slLastTime=null;
			return;
		}
	 	this.slLastTime=Utils.date(strValue,"yyyy-MM-dd");
	}
	
	/**
	* 最后登录时间       
	**/
	public void setSlLastTime(Date slLastTime){
		this.slLastTime = slLastTime;
		this.setSeted(F.slLastTime);
	}
	
	
	
	
	/*******************************最后登录IP**********************************/	
	/**
	* 最后登录IP       
	**/
	public String getSlLastIp(){
		if(this.slLastIp!=null){
			return this.slLastIp;
		}
		return this.slLastIp;
	}
	/**
	* 获取最后登录IP格式化(toString)
	**/
	public String getSlLastIp$(){
		String strValue="";
		 strValue=Utils.string(this.getSlLastIp());
	 	 return strValue;
	}
	/**
	* 根据最后登录IP反格式化
	**/
	public void setSlLastIp$(String strValue){
		if(Utils.empty(strValue)){
			this.slLastIp=null;
			return;
		}
	 	this.slLastIp=strValue;
	}
	
	/**
	* 最后登录IP       
	**/
	public void setSlLastIp(String slLastIp){
		this.slLastIp = slLastIp;
		this.setSeted(F.slLastIp);
	}
	
	
	
	
	/*******************************状态**********************************/	
	/**
	* 状态 [非空]   1:有效 0:无效    
	**/
	public Short getSlStatus(){
		if(this.slStatus!=null){
			return this.slStatus;
		}
		return this.slStatus;
	}
	/**
	* 获取状态格式化(toString)
	**/
	public String getSlStatus$(){
		String strValue="";
		 if(Utils.equals(Utils.string(this.getSlStatus()),"1"))
			strValue=Utils.string("有效");		 
		 if(Utils.equals(Utils.string(this.getSlStatus()),"0"))
			strValue=Utils.string("无效");		 
	 	 return strValue;
	}
	/**
	* 根据状态反格式化
	**/
	public void setSlStatus$(String strValue){
		if(Utils.empty(strValue)){
			this.slStatus=null;
			return;
		}
		 if(Utils.equals(strValue,"有效"))
		 	this.slStatus=Utils.parseShort("1");
		 if(Utils.equals(strValue,"无效"))
		 	this.slStatus=Utils.parseShort("0");
	}
	
	/**
	* 状态 [非空]   1:有效 0:无效    
	**/
	public void setSlStatus(Short slStatus){
		this.slStatus = slStatus;
		this.setSeted(F.slStatus);
	}
	
	
	
	
	/************LAZY3Q_DEFINE_CODE************/
	/************LAZY3Q_DEFINE_CODE************/
	
	
	/**
	 * 触发器
	 */
	public static void on(Trigger.Index index,final Notify.Listener listener,Trigger.Type... types){
		Notify.on(SrvLogin.class, index, listener, types);
	}
	public static void on(final Notify.Listener listener,String type){
		Notify.on(SrvLogin.class, listener, type);
	}
	/**
	 * 当修改字段时
	 * @param filedName
	 * @param listener
	 */
	public static void on(String filedName,final Notify.Listener listener){
		Notify.on(SrvLogin.class, listener, filedName);
	}
	/**
	 * 当修改字段为某值时
	 * @param filedName
	 * @param value
	 * @param listener
	 */
	public static void on(String filedName,Object value,final Notify.Listener listener){
		if(value==null)return;
		Notify.on(SrvLogin.class, listener, filedName+"."+Utils.md5(""+value));
	}
	public void notify(String type){
		Trigger.on(SrvLogin.class,type, this);
	}
	
	
	/**
	 * 用来获取当有字段关联对象时的获取方式,调用如${SrvLogin.obj.filedName}
	 * 因为有些变态的模板语言不能识别$，所以不能以${SrvLogin.$filedName}获取关联对象
	 */
	public Map getObj(){
		return new HashMap(){
			@Override
			public Object get(Object key) {
				try {
					return SrvLogin.class.getMethod("get$"+Utils.forMat(key.toString())).invoke(SrvLogin.this);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return null;
			}
		};
	}
	/**
	 * 用来获取某字段格式化的获取方式,调用如${SrvLogin.fmt.filedName}
	 * 因为有些变态的模板语言不能识别$，所以不能以${SrvLogin.filedName$}获取某字段格式化
	 */
	public Map getFmt(){
		return new HashMap(){
			@Override
			public Object get(Object key) {
				try {
					return SrvLogin.class.getMethod("get"+Utils.ForMat(key.toString()+"$")).invoke(SrvLogin.this);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return null;
			}
		};
	}
	/**
	 * 获取查询参数链式串
	 * @return
	 */
	public static @Deprecated M where(){ return new M(0); }
	public static @Deprecated M m(){ return new M(0); }
	public static M where = new M(0,true);
	public static @database(DatabaseNames.distribute_sys) class M extends IbatisMap{
		int type = 0; 
		M linked = null;
		Boolean proxy = false;
		public M set = null;
		public M(int type){
			this.type = type;
			if(this.type==0){
				set = new M(1,true);
				set.linked = this;
			}
		};
		public M(int type,Boolean proxy){
			this.type = type;
			this.proxy=proxy;
		};
		public M proxy(){
			M m = new M(this.type);//当前的对像
			if(this.type==0){
				m.set = new M(1,true);//set对象
				m.set.linked = m;
			}else{
				m.linked=this.linked;
				this.linked.linked=m;
			}
			return m;
		}
		public @Deprecated M set(){			
			M m = this;
			m.linked=new M(1);
			m.linked.linked=m;
			return m.linked;
		};
		public M on(IbatisMap value,C column,String joinColumn){if(proxy)return proxy().on(value,column,joinColumn);this.put(value.getClass().getDeclaringClass().getSimpleName(), value);value.put("on", column.toString());value.put("to", joinColumn);return this;};
		/** 编号 [非空]       **/
		public M slId(Object slId){if(proxy)return proxy().slId(slId);  this.put("slId", slId);return this;};
	 	/** and sl_id is null */
 		public M slIdNull(){if(proxy)return proxy().slIdNull();if(this.get("slIdNot")==null)this.put("slIdNot", "");this.put("slId", null);return this;};
 		/** not .... */
 		public M slIdNot(){if(proxy)return proxy().slIdNot();this.put("slIdNot", "not");return this;};
 		public M slIdNotNull(){if(proxy)return proxy().slIdNotNull();this.put("slIdNot", "not");this.put("slId", null);return this;};
 		public M slIdNot(Object slId){if(proxy)return proxy().slIdNot(slId);this.put("slIdNot", "not");this.put("slId", slId);return this;};
		/** and sl_id <= ? */
		public M slIdMin(Object min){if(proxy)return proxy().slIdMin(min);this.put("slIdMin", min);return this;};
		/** and sl_id >= ? */
		public M slIdMax(Object max){if(proxy)return proxy().slIdMax(max);this.put("slIdMax", max);return this;};
		public M slIdIn(String ids){
			if(proxy)return proxy().slIdIn(ids);  this.put("slIdIn", ids);return this;
		};	
		/** 用户名 [非空]       **/
		public M slUsername(Object slUsername){if(proxy)return proxy().slUsername(slUsername);  this.put("slUsername", slUsername);return this;};
	 	/** and sl_username is null */
 		public M slUsernameNull(){if(proxy)return proxy().slUsernameNull();if(this.get("slUsernameNot")==null)this.put("slUsernameNot", "");this.put("slUsername", null);return this;};
 		/** not .... */
 		public M slUsernameNot(){if(proxy)return proxy().slUsernameNot();this.put("slUsernameNot", "not");return this;};
 		public M slUsernameNotNull(){if(proxy)return proxy().slUsernameNotNull();this.put("slUsernameNot", "not");this.put("slUsername", null);return this;};
 		public M slUsernameNot(Object slUsername){if(proxy)return proxy().slUsernameNot(slUsername);this.put("slUsernameNot", "not");this.put("slUsername", slUsername);return this;};
		/** 密码 [非空]       **/
		public M slPassword(Object slPassword){if(proxy)return proxy().slPassword(slPassword);  this.put("slPassword", slPassword);return this;};
	 	/** and sl_password is null */
 		public M slPasswordNull(){if(proxy)return proxy().slPasswordNull();if(this.get("slPasswordNot")==null)this.put("slPasswordNot", "");this.put("slPassword", null);return this;};
 		/** not .... */
 		public M slPasswordNot(){if(proxy)return proxy().slPasswordNot();this.put("slPasswordNot", "not");return this;};
 		public M slPasswordNotNull(){if(proxy)return proxy().slPasswordNotNull();this.put("slPasswordNot", "not");this.put("slPassword", null);return this;};
 		public M slPasswordNot(Object slPassword){if(proxy)return proxy().slPasswordNot(slPassword);this.put("slPasswordNot", "not");this.put("slPassword", slPassword);return this;};
		/** 真实姓名 [非空]       **/
		public M slRealName(Object slRealName){if(proxy)return proxy().slRealName(slRealName);  this.put("slRealName", slRealName);return this;};
	 	/** and sl_real_name is null */
 		public M slRealNameNull(){if(proxy)return proxy().slRealNameNull();if(this.get("slRealNameNot")==null)this.put("slRealNameNot", "");this.put("slRealName", null);return this;};
 		/** not .... */
 		public M slRealNameNot(){if(proxy)return proxy().slRealNameNot();this.put("slRealNameNot", "not");return this;};
 		public M slRealNameNotNull(){if(proxy)return proxy().slRealNameNotNull();this.put("slRealNameNot", "not");this.put("slRealName", null);return this;};
 		public M slRealNameNot(Object slRealName){if(proxy)return proxy().slRealNameNot(slRealName);this.put("slRealNameNot", "not");this.put("slRealName", slRealName);return this;};
		/** 昵称    0:女 1:男     **/
		public M slNickName(Object slNickName){if(proxy)return proxy().slNickName(slNickName);  this.put("slNickName", slNickName);return this;};
	 	/** and sl_nick_name is null */
 		public M slNickNameNull(){if(proxy)return proxy().slNickNameNull();if(this.get("slNickNameNot")==null)this.put("slNickNameNot", "");this.put("slNickName", null);return this;};
 		/** not .... */
 		public M slNickNameNot(){if(proxy)return proxy().slNickNameNot();this.put("slNickNameNot", "not");return this;};
 		public M slNickNameNotNull(){if(proxy)return proxy().slNickNameNotNull();this.put("slNickNameNot", "not");this.put("slNickName", null);return this;};
 		public M slNickNameNot(Object slNickName){if(proxy)return proxy().slNickNameNot(slNickName);this.put("slNickNameNot", "not");this.put("slNickName", slNickName);return this;};
		/** 头像        **/
		public M slPortrait(Object slPortrait){if(proxy)return proxy().slPortrait(slPortrait);  this.put("slPortrait", slPortrait);return this;};
	 	/** and sl_portrait is null */
 		public M slPortraitNull(){if(proxy)return proxy().slPortraitNull();if(this.get("slPortraitNot")==null)this.put("slPortraitNot", "");this.put("slPortrait", null);return this;};
 		/** not .... */
 		public M slPortraitNot(){if(proxy)return proxy().slPortraitNot();this.put("slPortraitNot", "not");return this;};
 		public M slPortraitNotNull(){if(proxy)return proxy().slPortraitNotNull();this.put("slPortraitNot", "not");this.put("slPortrait", null);return this;};
 		public M slPortraitNot(Object slPortrait){if(proxy)return proxy().slPortraitNot(slPortrait);this.put("slPortraitNot", "not");this.put("slPortrait", slPortrait);return this;};
		/** 个性签名        **/
		public M slSignature(Object slSignature){if(proxy)return proxy().slSignature(slSignature);  this.put("slSignature", slSignature);return this;};
	 	/** and sl_signature is null */
 		public M slSignatureNull(){if(proxy)return proxy().slSignatureNull();if(this.get("slSignatureNot")==null)this.put("slSignatureNot", "");this.put("slSignature", null);return this;};
 		/** not .... */
 		public M slSignatureNot(){if(proxy)return proxy().slSignatureNot();this.put("slSignatureNot", "not");return this;};
 		public M slSignatureNotNull(){if(proxy)return proxy().slSignatureNotNull();this.put("slSignatureNot", "not");this.put("slSignature", null);return this;};
 		public M slSignatureNot(Object slSignature){if(proxy)return proxy().slSignatureNot(slSignature);this.put("slSignatureNot", "not");this.put("slSignature", slSignature);return this;};
		/** 微信ID        **/
		public M slWxOpenid(Object slWxOpenid){if(proxy)return proxy().slWxOpenid(slWxOpenid);  this.put("slWxOpenid", slWxOpenid);return this;};
	 	/** and sl_wx_openid is null */
 		public M slWxOpenidNull(){if(proxy)return proxy().slWxOpenidNull();if(this.get("slWxOpenidNot")==null)this.put("slWxOpenidNot", "");this.put("slWxOpenid", null);return this;};
 		/** not .... */
 		public M slWxOpenidNot(){if(proxy)return proxy().slWxOpenidNot();this.put("slWxOpenidNot", "not");return this;};
 		public M slWxOpenidNotNull(){if(proxy)return proxy().slWxOpenidNotNull();this.put("slWxOpenidNot", "not");this.put("slWxOpenid", null);return this;};
 		public M slWxOpenidNot(Object slWxOpenid){if(proxy)return proxy().slWxOpenidNot(slWxOpenid);this.put("slWxOpenidNot", "not");this.put("slWxOpenid", slWxOpenid);return this;};
		public M slCurrUser$on(SrvUser.M value){if(proxy)return proxy().slCurrUser$on(value);this.put("SlCurrUser", value);value.put("on", "sl_curr_user");return this;};
		/** 当前用户  [SrvUser]      **/
		public M slCurrUser(Object slCurrUser){if(proxy)return proxy().slCurrUser(slCurrUser);  this.put("slCurrUser", slCurrUser);return this;};
	 	/** and sl_curr_user is null */
 		public M slCurrUserNull(){if(proxy)return proxy().slCurrUserNull();if(this.get("slCurrUserNot")==null)this.put("slCurrUserNot", "");this.put("slCurrUser", null);return this;};
 		/** not .... */
 		public M slCurrUserNot(){if(proxy)return proxy().slCurrUserNot();this.put("slCurrUserNot", "not");return this;};
 		public M slCurrUserNotNull(){if(proxy)return proxy().slCurrUserNotNull();this.put("slCurrUserNot", "not");this.put("slCurrUser", null);return this;};
 		public M slCurrUserNot(Object slCurrUser){if(proxy)return proxy().slCurrUserNot(slCurrUser);this.put("slCurrUserNot", "not");this.put("slCurrUser", slCurrUser);return this;};
		public M slCurrUserIn(String ids){
			if(proxy)return proxy().slCurrUserIn(ids);  this.put("slCurrUserIn", ids);return this;
		};	
		/** 添加时间        **/
		public M slAddTime(Object slAddTime){if(proxy)return proxy().slAddTime(slAddTime);  this.put("slAddTime", slAddTime);return this;};
	 	/** and sl_add_time is null */
 		public M slAddTimeNull(){if(proxy)return proxy().slAddTimeNull();if(this.get("slAddTimeNot")==null)this.put("slAddTimeNot", "");this.put("slAddTime", null);return this;};
 		/** not .... */
 		public M slAddTimeNot(){if(proxy)return proxy().slAddTimeNot();this.put("slAddTimeNot", "not");return this;};
 		public M slAddTimeNotNull(){if(proxy)return proxy().slAddTimeNotNull();this.put("slAddTimeNot", "not");this.put("slAddTime", null);return this;};
 		public M slAddTimeNot(Object slAddTime){if(proxy)return proxy().slAddTimeNot(slAddTime);this.put("slAddTimeNot", "not");this.put("slAddTime", slAddTime);return this;};
 		/** and sl_add_time >= ? */
 		public M slAddTimeStart(Object start){if(proxy)return proxy().slAddTimeStart(start);this.put("slAddTimeStart", start);return this;};			
 		/** and sl_add_time <= ? */
 		public M slAddTimeEnd(Object end){if(proxy)return proxy().slAddTimeEnd(end);this.put("slAddTimeEnd", end);return this;};
		/** 最后登录时间        **/
		public M slLastTime(Object slLastTime){if(proxy)return proxy().slLastTime(slLastTime);  this.put("slLastTime", slLastTime);return this;};
	 	/** and sl_last_time is null */
 		public M slLastTimeNull(){if(proxy)return proxy().slLastTimeNull();if(this.get("slLastTimeNot")==null)this.put("slLastTimeNot", "");this.put("slLastTime", null);return this;};
 		/** not .... */
 		public M slLastTimeNot(){if(proxy)return proxy().slLastTimeNot();this.put("slLastTimeNot", "not");return this;};
 		public M slLastTimeNotNull(){if(proxy)return proxy().slLastTimeNotNull();this.put("slLastTimeNot", "not");this.put("slLastTime", null);return this;};
 		public M slLastTimeNot(Object slLastTime){if(proxy)return proxy().slLastTimeNot(slLastTime);this.put("slLastTimeNot", "not");this.put("slLastTime", slLastTime);return this;};
 		/** and sl_last_time >= ? */
 		public M slLastTimeStart(Object start){if(proxy)return proxy().slLastTimeStart(start);this.put("slLastTimeStart", start);return this;};			
 		/** and sl_last_time <= ? */
 		public M slLastTimeEnd(Object end){if(proxy)return proxy().slLastTimeEnd(end);this.put("slLastTimeEnd", end);return this;};
		/** 最后登录IP        **/
		public M slLastIp(Object slLastIp){if(proxy)return proxy().slLastIp(slLastIp);  this.put("slLastIp", slLastIp);return this;};
	 	/** and sl_last_ip is null */
 		public M slLastIpNull(){if(proxy)return proxy().slLastIpNull();if(this.get("slLastIpNot")==null)this.put("slLastIpNot", "");this.put("slLastIp", null);return this;};
 		/** not .... */
 		public M slLastIpNot(){if(proxy)return proxy().slLastIpNot();this.put("slLastIpNot", "not");return this;};
 		public M slLastIpNotNull(){if(proxy)return proxy().slLastIpNotNull();this.put("slLastIpNot", "not");this.put("slLastIp", null);return this;};
 		public M slLastIpNot(Object slLastIp){if(proxy)return proxy().slLastIpNot(slLastIp);this.put("slLastIpNot", "not");this.put("slLastIp", slLastIp);return this;};
		/** 状态 [非空]   1:有效 0:无效     **/
		public M slStatus(Object slStatus){if(proxy)return proxy().slStatus(slStatus);  this.put("slStatus", slStatus);return this;};
	 	/** and sl_status is null */
 		public M slStatusNull(){if(proxy)return proxy().slStatusNull();if(this.get("slStatusNot")==null)this.put("slStatusNot", "");this.put("slStatus", null);return this;};
 		/** not .... */
 		public M slStatusNot(){if(proxy)return proxy().slStatusNot();this.put("slStatusNot", "not");return this;};
 		public M slStatusNotNull(){if(proxy)return proxy().slStatusNotNull();this.put("slStatusNot", "not");this.put("slStatus", null);return this;};
 		public M slStatusNot(Object slStatus){if(proxy)return proxy().slStatusNot(slStatus);this.put("slStatusNot", "not");this.put("slStatus", slStatus);return this;};
		public M slStatusIn(String ids){
			if(proxy)return proxy().slStatusIn(ids);  this.put("slStatusIn", ids);return this;
		};	
	 	public M add(String key, Object value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	 	public M add(F key, Object value) {if(proxy)return proxy().add(key,value);this.put(key.toString(), value);return this;}
	 	public M desc(C key) {if(proxy)return proxy().desc(key);this.put("desc", key.column);return this;}
	 	public M asc(C key) {if(proxy)return proxy().asc(key);this.put("asc", key.column);return this;}
	 	public M desc(String sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	 	public M asc(String sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	 	public M definex(String sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	 	/** 获取所有登录帐号 **/
		public @api List<SrvLogin> list(Integer size){			
			return getSrvLoginList(this,size);
		}
		/** 获取登录帐号分页 **/
		public @api Page<SrvLogin> page(Integer page,Integer size){			
			return getSrvLoginPage(page, size , this);
		}
		/** 根据查询条件取登录帐号 **/
		public @api SrvLogin get(){			
			return getSrvLogin(this);
		}
		/** 获取登录帐号数 **/
		public @api Long count(){			
			return getSrvLoginCount(this);
		}
		/** 获取登录帐号表达式 **/
		public @api <T> T eval(String strEval){			
			return getSrvLoginEval(strEval,this);
		}
		/** 获取登录帐号统计 **/
		public @api List<Map> stats(C sumKey,C groupKey,int dateType){			
			return getSrvLoginStats(this,sumKey,groupKey,dateType);
		}
		/** 获取登录帐号统计 **/
		public @api List<Map> stats(C sumKey,C groupKey){			
			return getSrvLoginStats(this,sumKey,groupKey,-1);
		}
		/** 根据条件更新 **/
		public @api int update(){			
			M where = null;
			M set = null;
			if(this.type==0){
				if(this.linked==null)throw new RuntimeException("未发set");
				where = this;
				set = this.linked;
			}else{
				if(this.linked==null)throw new RuntimeException("未发where条件");
				set = this;
				where = this.linked;
			}
			return updateSrvLogin(set,where);
		}
		/** 根据条件删除 **/
		public @api void delete(){			
			deleteSrvLogin(this);
		}
	}
	
	public static class Param extends M{
		public Param(int type) {
			super(type);
		}
		public Param(int type, Boolean proxy) {
			super(type, proxy);
		}
	}
	
	/** 对象的字段描述 **/
	public static class F{
		/** 编号 [非空]       **/
		public final static @type(Long.class)  String slId="slId";
		/** 用户名 [非空]       **/
		public final static @type(String.class)  String slUsername="slUsername";
		/** 密码 [非空]       **/
		public final static @type(String.class)  String slPassword="slPassword";
		/** 真实姓名 [非空]       **/
		public final static @type(String.class)  String slRealName="slRealName";
		/** 昵称    0:女 1:男     **/
		public final static @type(String.class)  String slNickName="slNickName";
		/** 头像        **/
		public final static @type(String.class)  String slPortrait="slPortrait";
		/** 个性签名        **/
		public final static @type(String.class) @like String slSignature="slSignature";
		/** 微信ID        **/
		public final static @type(String.class)  String slWxOpenid="slWxOpenid";
		/** 当前用户  [SrvUser]      **/
		public final static @type(Long.class)  String slCurrUser="slCurrUser";
		/** 添加时间        **/
		public final static @type(Date.class)  String slAddTime="slAddTime";
	 	/** and sl_add_time >= ? */
 		public final static @type(Date.class) String slAddTimeStart="slAddTimeStart";
 		/** and sl_add_time <= ? */
 		public final static @type(Date.class) String slAddTimeEnd="slAddTimeEnd";
		/** 最后登录时间        **/
		public final static @type(Date.class)  String slLastTime="slLastTime";
	 	/** and sl_last_time >= ? */
 		public final static @type(Date.class) String slLastTimeStart="slLastTimeStart";
 		/** and sl_last_time <= ? */
 		public final static @type(Date.class) String slLastTimeEnd="slLastTimeEnd";
		/** 最后登录IP        **/
		public final static @type(String.class)  String slLastIp="slLastIp";
		/** 状态 [非空]   1:有效 0:无效     **/
		public final static @type(Short.class)  String slStatus="slStatus";
	 	public static String get(String name){
			try {
				Field field = F.class.getField(name);
				if(field!=null)
					return field.get(null).toString();
			} catch (Exception e) {
				//e.printStackTrace();
			}
			return null;
		}
	}
	/** 对象的数据库字段描述 **/
	public static enum C{
		slId("sl_id"),
		slUsername("sl_username"),
		slPassword("sl_password"),
		slRealName("sl_real_name"),
		slNickName("sl_nick_name"),
		slPortrait("sl_portrait"),
		slSignature("sl_signature"),
		slWxOpenid("sl_wx_openid"),
		slCurrUser("sl_curr_user"),
		slAddTime("sl_add_time"),
		slLastTime("sl_last_time"),
		slLastIp("sl_last_ip"),
		slStatus("sl_status"),
		count("count");
		String column;
		C(String column){
			this.column = column;
		}
		public String toString(){
			return this.column;
		}
		public static String get(String name){
			try {
				Field field = C.class.getField(name);
				if(field!=null)
					return field.get(null).toString();
			} catch (Exception e) {
				//e.printStackTrace();
			}
			return null;
		}
	}
	
	
	
	/**
	* 获取登录帐号数据
	**/
	public static Object getData(Object param){
		if(param==null)
			return null;
		Object value = null;
		if(param.getClass()==Long.class)
			value = SrvLogin.get((Long)param);
		else if(param instanceof java.util.Map){
			java.util.Map params = (Map) param;
			if(params.get("size")==null)
				value = SrvLogin.getSrvLogin(params);
			else
				value = SrvLogin.getSrvLoginList(params, (Integer) params.get("size"));
		}else if(param.getClass()==Long.class )
			value =  SrvLogin.where().slId(param).get();
		else if(!Utils.empty(param.toString()))
			value = SrvLogin.get(Long.valueOf(param.toString()));
		return value;
	}
	
	/**对象转json**/
	public Map toJSON(){
		return toJSON(false);
	}
	public Map toJSON(boolean simple){
		Map map = new HashMap();
		map.put("id",this.getSlId());
		Utils.fms(map,simple?"id":"slId",this.getSlId(),this.getSlId$());
		Utils.fms(map,simple?"username":"slUsername",this.getSlUsername(),this.getSlUsername$());
		Utils.fms(map,simple?"password":"slPassword",this.getSlPassword(),this.getSlPassword$());
		Utils.fms(map,simple?"realName":"slRealName",this.getSlRealName(),this.getSlRealName$());
		Utils.fms(map,simple?"nickName":"slNickName",this.getSlNickName(),this.getSlNickName$());
		Utils.fms(map,simple?"portrait":"slPortrait",this.getSlPortrait(),this.getSlPortrait$());
		Utils.fms(map,simple?"signature":"slSignature",this.getSlSignature(),this.getSlSignature$());
		Utils.fms(map,simple?"wxOpenid":"slWxOpenid",this.getSlWxOpenid(),this.getSlWxOpenid$());
		Utils.fms(map,simple?"currUser":"slCurrUser",this.getSlCurrUser(),this.getSlCurrUser$());
		Utils.fms(map,simple?"addTime":"slAddTime",this.getSlAddTime(),this.getSlAddTime$());
		Utils.fms(map,simple?"lastTime":"slLastTime",this.getSlLastTime(),this.getSlLastTime$());
		Utils.fms(map,simple?"lastIp":"slLastIp",this.getSlLastIp(),this.getSlLastIp$());
		Utils.fms(map,simple?"status":"slStatus",this.getSlStatus(),this.getSlStatus$());
		if(this.suffix!=null)map.put("suffix", this.suffix);
		/************LAZY3Q_DEFINE_TOJSON************/
		/************LAZY3Q_DEFINE_TOJSON************/
		return map;
	}
	/**对象转map**/
	public Map toMap(){
		Map map = new HashMap();
		map.put("slId",this.getSlId());
		map.put("slUsername",this.getSlUsername());
		map.put("slPassword",this.getSlPassword());
		map.put("slRealName",this.getSlRealName());
		map.put("slNickName",this.getSlNickName());
		map.put("slPortrait",this.getSlPortrait());
		map.put("slSignature",this.getSlSignature());
		map.put("slWxOpenid",this.getSlWxOpenid());
		map.put("slCurrUser",this.getSlCurrUser());
		map.put("slAddTime",this.getSlAddTime());
		map.put("slLastTime",this.getSlLastTime());
		map.put("slLastIp",this.getSlLastIp());
		map.put("slStatus",this.getSlStatus());
		map.put("suffix", this.suffix);
		/************LAZY3Q_DEFINE_TOMAP************/
		/************LAZY3Q_DEFINE_TOMAP************/
		return map;
	}
	/**map转对象**/
	public static SrvLogin fromMap(Map map){
		SrvLogin srvLogin = new SrvLogin();
		srvLogin.slId = Utils.parseLong(map.get("slId"));
		srvLogin.slUsername = Utils.parseString(map.get("slUsername"));
		srvLogin.slPassword = Utils.parseString(map.get("slPassword"));
		srvLogin.slRealName = Utils.parseString(map.get("slRealName"));
		srvLogin.slNickName = Utils.parseString(map.get("slNickName"));
		srvLogin.slPortrait = Utils.parseString(map.get("slPortrait"));
		srvLogin.slSignature = Utils.parseString(map.get("slSignature"));
		srvLogin.slWxOpenid = Utils.parseString(map.get("slWxOpenid"));
		srvLogin.slCurrUser = Utils.parseLong(map.get("slCurrUser"));
		srvLogin.slAddTime = Utils.parseDate(map.get("slAddTime"));
		srvLogin.slLastTime = Utils.parseDate(map.get("slLastTime"));
		srvLogin.slLastIp = Utils.parseString(map.get("slLastIp"));
		srvLogin.slStatus = Utils.parseShort(map.get("slStatus"));
		return srvLogin;
	}
	
	
	
	/**字段设置标记队列**/
	private Map<String,Boolean> seted=new HashMap();
	public Boolean getSeted(String key){
		return seted.get(key);
	}
	public void setSeted(String key){
		seted.put(key,true);
	}
	/**同步未set的字段**/
	public void mergeSet(SrvLogin old){
		Field[] fields = this.getClass().getDeclaredFields();
		try {
			for(Field field:fields){
				String key = field.getName();
				if(seted.get(key)==null && field.getAnnotation(column.class)!=null){
					field.setAccessible(true);
					field.set(this, field.get(old));					
				}
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
	
		
	/**自定义变量存储**/
	private Map values=new HashMap();
	public Map getValues(){
		return values;
	}
	public void setValues(String name,Object value){
		values.put(name,value);
	}
	
	/**分表时的表名后缀**/
	private String suffix;
	public String getSuffix() {
		return suffix;
	}
	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}
	/**获取数据库名称**/
	public static String getDataBaseName(){
		return Utils.config("spring.datasource.distribute_sys.name");
	}
	
	public static String getIcon(){
		return "/images/icons/2008112220121595877808.png";
	}
	public static String getIconfont(){
		return "icon-quanxianshenhe";
	}
	public static enum ACT{
		列表,修改,详情
	};
	public static String getUrl(ACT act,SrvLogin.M params){
		if(params==null)params=new SrvLogin.M(0);
		params.remove("joins");
		params.remove("definexs");
		params.remove("distinct");
		String strUrl = "/admin/permissions/login.edit.html?";
		if(params.get("slId")!=null){
			strUrl+="&id="+Utils.encode(""+params.get("slId"),Utils.UTF8);
		}
		if(act==ACT.列表){
			strUrl = "/admin/permissions/login.html?1=1";
		}else if(act==ACT.修改){
			strUrl+="&edittype=update";
		}else if(act==ACT.详情){
			strUrl+="&edittype=detail";
		}		
		if(params!=null){
			for(Object key:params.keySet()){
				strUrl+="&"+key+"="+Utils.encode(""+params.get(key),Utils.UTF8)+"";
			}
		}
		return strUrl;
	}
	public String getDetailUrl(){
		return this.getUrl(ACT.详情, where.slId(this.getId()));
	}
	
	/**
	* 转跳到当前地址
	**/
	public static Protocol redirect(SrvLogin.ACT act,SrvLogin.M params){
		Protocol protocol = Protocol.create(true,null,"ACT_REDIRECT");
		protocol.set("url",SrvLogin.getUrl(act, params));
		return protocol;
	}
	/**
	* 打开一个新的tab页面
	**/
	public static Protocol href(SrvLogin.ACT act,SrvLogin.M params){
		Protocol protocol = Protocol.create(true,null,"ACT_HREF");
		protocol.set("url",SrvLogin.getUrl(act, params));
		protocol.set("title",act.name());
		return protocol;
	}
	/**
	* 显示一个消息框，并且关闭当前的对话框
	**/
	public static Protocol message(String message){
		Protocol protocol = Protocol.create(true,null,"ACT_MESSAGE");
		protocol.set("message",message);
		return protocol;
	}
	
	
	static com.distribute.framework.dao.ISrvLoginDao getSrvLoginDao(){
		return Utils.getBean("srvLoginDao");
	};
	
}